package com.ruoyi.web.controller.fjzt;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.fjzt.domain.TbFjglFjzt1;
import com.ruoyi.fjzt.service.ITbFjglFjzt1Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 房间状态Controller
 * 
 * @author ruoyi
 * @date 2023-11-18
 */
@RestController
@RequestMapping("/fjzt/fjzt1")
public class TbFjglFjzt1Controller extends BaseController
{
    @Autowired
    private ITbFjglFjzt1Service tbFjglFjzt1Service;

    /**
     * 查询房间状态列表
     */
    @PreAuthorize("@ss.hasPermi('fjzt:fjzt1:list')")
    @GetMapping("/list")
    public TableDataInfo list(TbFjglFjzt1 tbFjglFjzt1)
    {
        startPage();
        List<TbFjglFjzt1> list = tbFjglFjzt1Service.selectTbFjglFjzt1List(tbFjglFjzt1);
        return getDataTable(list);
    }

    /**
     * 导出房间状态列表
     */
    @PreAuthorize("@ss.hasPermi('fjzt:fjzt1:export')")
    @Log(title = "房间状态", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbFjglFjzt1 tbFjglFjzt1)
    {
        List<TbFjglFjzt1> list = tbFjglFjzt1Service.selectTbFjglFjzt1List(tbFjglFjzt1);
        ExcelUtil<TbFjglFjzt1> util = new ExcelUtil<TbFjglFjzt1>(TbFjglFjzt1.class);
        util.exportExcel(response, list, "房间状态数据");
    }

    /**
     * 获取房间状态详细信息
     */
    @PreAuthorize("@ss.hasPermi('fjzt:fjzt1:query')")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") Long ID)
    {
        return success(tbFjglFjzt1Service.selectTbFjglFjzt1ByID(ID));
    }

    /**
     * 新增房间状态
     */
    @PreAuthorize("@ss.hasPermi('fjzt:fjzt1:add')")
    @Log(title = "房间状态", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbFjglFjzt1 tbFjglFjzt1)
    {
        return toAjax(tbFjglFjzt1Service.insertTbFjglFjzt1(tbFjglFjzt1));
    }

    /**
     * 修改房间状态
     */
    @PreAuthorize("@ss.hasPermi('fjzt:fjzt1:edit')")
    @Log(title = "房间状态", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbFjglFjzt1 tbFjglFjzt1)
    {
        return toAjax(tbFjglFjzt1Service.updateTbFjglFjzt1(tbFjglFjzt1));
    }

    /**
     * 删除房间状态
     */
    @PreAuthorize("@ss.hasPermi('fjzt:fjzt1:remove')")
    @Log(title = "房间状态", businessType = BusinessType.DELETE)
	@DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable Long[] IDs)
    {
        return toAjax(tbFjglFjzt1Service.deleteTbFjglFjzt1ByIDs(IDs));
    }

    /**
     * 智能控制管理
     */
    @GetMapping("/WSD")
    public AjaxResult list()
    {

        return success(tbFjglFjzt1Service.selectTbFjglFjzt1ListWSD());
    }

}
